<%@page import="vo.Student"%>
<%@page import="java.util.List"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
    <jsp:useBean id = "db" class = "dbc.DBOperator" scope = "page"></jsp:useBean>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Insert title here</title>
</head>
<body>
查询学生信息
<form action = "findStudent.jsp">
请输入要查询学生的学号：
<input type = "text" name = "sid">
<input type = "submit" value = "查询">
</form>

<%
String sid = request.getParameter("sid");
List<Student> stus = null;
if (sid == null) {
    stus = db.doQuery();
} else {
    stus = db.doSelectById(sid);
}
Student stu = null;
for (int i = 0; i < stus.size(); i++) {
    stu = stus.get(i);
	%>
	<table border=1 width="50%">
	<tr>
	<td><%=stu.getSid() %></td>
	<td><%=stu.getSname() %></td>
	<td><%=stu.getSex() %></td>
	<td><%=stu.getAge() %></td>
	<td><%=stu.getSclass() %></td>
	</tr>
	<%
}
	%>
</table>
</body>
</html>